﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace Sublimation
{

    public enum ScreenStates
    {
        start,
        inGame,
        end,
        tuto1,
        tuto2,
        highscores,
        credits
    }
    public class EndScreen : GameObject
    {
        protected ScreenStates state;
        public ScreenStates State
        {
            get { return state; }
            set { state = value; }
        }
        protected Texture2D start, end, tuto1, tuto2, highscores,credits;
        public EndScreen(WorldProperties worldProperties):base(worldProperties)
        {
            LoadContent();
            scale = 1f;
            position = Vector2.Zero;
            DrawOrder = 200;
            state = ScreenStates.start;
            Sprite = start;
            
        }
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            switch (state)
            {
                case ScreenStates.start:
                    Sprite = start;
                    break;
                case ScreenStates.inGame:
                    Sprite = null;
                    break;
                case ScreenStates.highscores:
                    Sprite = highscores;
                    break;
                case ScreenStates.tuto1:
                    Sprite = tuto1;
                    break;
                case ScreenStates.tuto2:
                    Sprite = tuto2;
                    break;
                case ScreenStates.end:
                    Sprite = end;
                    
                    break;
            }
        }
        protected override void  LoadContent()
        {
            base.LoadContent();
            start = Game.Content.Load<Texture2D>("Sprites/screen/start_screen");

            end = Game.Content.Load<Texture2D>("Sprites/screen/end_screen_summary");

            tuto1 = Game.Content.Load<Texture2D>("Sprites/screen/instruction_tower");

            tuto2 = Game.Content.Load<Texture2D>("Sprites/screen/instruction_HUD");

            highscores = Game.Content.Load<Texture2D>("Sprites/screen/high_score");

            credits = Game.Content.Load<Texture2D>("Sprites/screen/credit_screen");
        }
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (state == ScreenStates.end)
            {
                worldProperties.HighScore.displayCurrentScore(spriteBatch,worldProperties.GameFont);
            }
            else if (state == ScreenStates.highscores)
            {
                worldProperties.HighScore.displayHighScores(spriteBatch, worldProperties.GameFont);
            }
        }
    }
}
